/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package verins.beans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author yi
 */
@Entity
@Table(name = "tubigeo", schema = "verinscribe")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tubigeo.findAll", query = "SELECT t FROM Tubigeo t"),
    @NamedQuery(name = "Tubigeo.findByIdubigeo", query = "SELECT t FROM Tubigeo t WHERE t.idubigeo = :idubigeo"),
    @NamedQuery(name = "Tubigeo.findByDescripcion", query = "SELECT t FROM Tubigeo t WHERE t.descripcion = :descripcion")})
public class Tubigeo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idubigeo", nullable = false, length = 6)
    //@GeneratedValue(generator="verinscribe.partidopolitico_idpartidopolitico_seq",strategy=GenerationType.IDENTITY)
    private String idubigeo;
    @Basic(optional = false)
    @Column(name = "descripcion", nullable = false, length = 50)
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tubigeo")
    private List<Ubigeoxprocesoelectoral> ubigeoxprocesoelectoralList;

    public Tubigeo() {
    }

    public Tubigeo(String idubigeo) {
        this.idubigeo = idubigeo;
    }

    public Tubigeo(String idubigeo, String descripcion) {
        this.idubigeo = idubigeo;
        this.descripcion = descripcion;
    }

    public String getIdubigeo() {
        return idubigeo;
    }

    public void setIdubigeo(String idubigeo) {
        this.idubigeo = idubigeo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public List<Ubigeoxprocesoelectoral> getUbigeoxprocesoelectoralList() {
        return ubigeoxprocesoelectoralList;
    }

    public void setUbigeoxprocesoelectoralList(List<Ubigeoxprocesoelectoral> ubigeoxprocesoelectoralList) {
        this.ubigeoxprocesoelectoralList = ubigeoxprocesoelectoralList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idubigeo != null ? idubigeo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tubigeo)) {
            return false;
        }
        Tubigeo other = (Tubigeo) object;
        if ((this.idubigeo == null && other.idubigeo != null) || (this.idubigeo != null && !this.idubigeo.equals(other.idubigeo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return descripcion;
    }
    
}
